import javax.swing.tree.TreeNode;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        Queue<Integer> qu1=new LinkedList<>();
        qu1.offer(1);
        qu1.poll();
        Stack<Integer> s1=new Stack<>();
        SingleLinkedList list=new SingleLinkedList();
        list.addFirst(1);
        list.addFirst(1);
        list.addLast(34);
        list.addFirst(1);
        list.addIndex(3,3);
        list.addIndex(0,10);
        list.removeAllKey(34);
        list.display();

        System.out.println(list.size());
    }
    static class TreeNode{

        char val;
        public TreeNode left;
        public TreeNode right;
    }
    int size=0;

    public void getLeafNodeCount(TreeNode root) {
        if(root==null){
            return;
        }
        if(root.left==null&&root.right==null){
            size++;
        }
        getLeafNodeCount(root.left);
        getLeafNodeCount(root.right);
    }


    public int getLeafNodeCount2(TreeNode root) {
        if(root==null){
            return 0;
        }
        if(root.left==null&&root.right==null){
            return 1;
        }
        return getLeafNodeCount2(root.left)+getLeafNodeCount2(root.right);
    }
    public TreeNode findVal(TreeNode root,char val) {
        if(root==null){
            return null;
        }
        if(val==root.val){
            return root;
        }

        TreeNode left=findVal(root.left,val);
        if(left!=null){
            return left;
        }
        TreeNode right=findVal(root.right,val);
        if(right!=null){
            return right;
        }
        return null;
    }
    public int gekKlNodeCount(TreeNode root,int k){
        if(root==null){
            return 0;
        }
        if(k==1){
            return 1;
        }
        return gekKlNodeCount(root.left,k-1)+gekKlNodeCount(root.right,k-1);
    }
}
